﻿[
{
    "name": "Get geo location",
    "desc": "Provides access to the current geographic location. ",
    "source": function () {
        console.log("Getting geo position ...");
        new Windows.Devices.Geolocation.Geolocator().getGeopositionAsync().then(function () {
            console.log(result);
        }, function () {
            console.log(result);
        });
    }
},
{
    "name": "Accelerometer",
    "desc": "Represents an accelerometer sensor. This sensor returns G-force values with respect to the x-, y-, and z-axes.",
    "source": function () {
        var accelerometer = Windows.Devices.Sensors.Accelerometer.getDefault();
        if (accelerometer) {
            var accelerometerReading = accelerometer.getCurrentReading();
            console.log(accelerometerReading.accelerationX + " " + accelerometerReading.accelerationY + " " + accelerometerReading.accelerationZ);
        }else {
            console.log("Sensor not detected");
        }
    }
},
{
    "name": "Compass",
    "desc": "This sensor returns a heading with respect to True North and, possibly, Magnetic North. (The latter is dependent on the sensor capabilities.)",
    "source": function () {
        var device = Windows.Devices.Sensors.Compass.getDefault();
        if (device) {
            var reading = device.getCurrentReading();
            console.log(reading.headingMagneticNorth + "," + reading.headingTrueNorth);
        }else {
            console.log("Sensor not detected");
        }
    }
}, {
    "name": "Gyrometer",
    "desc": "This sensor returns angular velocity values with respect to the x-, y-, and z-axes.",
    "source": function () {
        var device = Windows.Devices.Sensors.Gyrometer.getDefault();
        if (device) {
            var reading = device.getCurrentReading();
            console.log(reading.angularVelocityX + " " + reading.angularVelocityY + " " + reading.angularVelocityZ);
        }else {
            console.log("Sensor not detected");
        }
    }
},
{
    "name": "Inclinometer",
    "desc": "This sensor returns pitch, roll, and yaw values which correspond to rotation angles about the x-, y-, and z-axis respectively.",
    "source": function () {
        var device = Windows.Devices.Sensors.Inclinometer.getDefault();
        if (device) {
            var reading = device.getCurrentReading();
            console.log(reading.pitchDegrees + " " + reading.rollDegrees + " " + reading.yawDegrees);
        }else {
            console.log("Sensor not detected");
        }
    }
},
{
    "name": "LightSensor",
    "desc": "This sensor returns the ambient-light reading as a LUX value.",
    "source": function () {
        var device = Windows.Devices.Sensors.LightSensor.getDefault();
        if (device) {
            var reading = device.getCurrentReading();
            console.log(reading.illuminanceInLux);
        }else {
            console.log("Sensor not detected");
        }
    }
},
{
    "name": "OrientationSensor",
    "desc": "This sensor returns a rotation matrix and a Quaternion that can be used to adjust the user's perspective in a game application.",
    "source": function () {
        var device = Windows.Devices.Sensors.OrientationSensor.getDefault();
        if (device) {
            var reading = device.getCurrentReading();
            console.log(reading.quaternion.x + "," + reading.quaternion.y + "," + reading.quaternion.z + "," + reading.quaternion.w + ",");
        }else {
            console.log("Sensor not detected");
        }
    }
}
]